package com.example.fp.cgc.mapper

import com.baomidou.mybatisplus.core.mapper.BaseMapper
import com.example.fp.cgc.entity.Notice
import org.apache.ibatis.annotations.Select
import org.apache.ibatis.annotations.Update

/**
 * @since 2020-03-06
 */
interface NoticeMapper : BaseMapper<Notice> {

    @Select("SELECT * FROM notice WHERE toId = #{uid} and isRead = false")
    fun getUnreadNotice(uid: Int): List<Notice>

    @Update("UPDATE notice SET isRead = true WHERE toId = #{uid}")
    fun setNoticeRead(uid: Int)
}